from pytest_vnc import Rect, Point


def test_thing(vnc):
    # Screenshot
    print(vnc.rect.width, vnc.rect.height)
    pixels = vnc.capture()  # rgba numpy array of entire screen
    pixels = vnc.capture(Rect(x=100, y=0, width=50, height=75))
    # to use PIL/pillow:
    # image = Image.fromarray(pixels)

    # Keyboard input
    vnc.write('hi there!')  # keys are queued
    vnc.press('Ctrl', 'c')  # keys are stacked
    with vnc.hold('Ctrl'):
        vnc.press('Esc')

    # Mouse input
    vnc.move(Point(100, 200))
    vnc.click()
    vnc.double_click()
    vnc.middle_click()
    vnc.right_click()
    vnc.scroll_up()
    vnc.scroll_down(repeat=10)
    with vnc.drag():
        vnc.move(Point(300, 400))
    with vnc.middle_drag():
        vnc.move(Point(500, 600))
    with vnc.right_drag():
        vnc.move(Point(700, 800))